package com.hs.srm.admin.modules.requisition.controller;


import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.toolkit.CollectionUtils;
import com.hs.srm.admin.common.util.StringUtils;
import com.hs.srm.admin.modules.orders.entity.ScmPoHeaderEntity;
import com.hs.srm.admin.modules.orders.entity.ScmPoItemEntity;
import com.hs.srm.admin.modules.orders.service.ScmPoHeaderService;
import com.hs.srm.admin.modules.orders.service.ScmPoItemService;
import com.hs.srm.admin.modules.pricemanagement.entity.HistoricalPriceEntity;
import com.hs.srm.admin.modules.pricemanagement.service.HistoricalPriceService;
import com.hs.srm.admin.modules.requisition.entity.NproPurchRequestHeaderEntity;
import com.hs.srm.admin.modules.requisition.entity.NproPurchRequestItemEntity;
import com.hs.srm.admin.modules.requisition.service.NproPurchRequestHeaderService;
import com.hs.srm.admin.modules.requisition.service.NproPurchRequestItemService;
import com.hs.srm.admin.modules.requisition.vo.SupplyGoodsEntityVO;
import com.hs.srm.admin.modules.sys.controller.AbstractController;
import com.hs.srm.base.common.annotation.SysLog;
import com.hs.srm.common.utils.DateUtils;
import com.hs.srm.common.utils.PageUtils;
import com.hs.srm.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import sunnykid.text.SunnykidText;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @author yanfei
 * @date 2019年2月14日
 * 非生产性采购申请头信息
 */
@RestController
@RequestMapping("/nproPurchRequestHeader")
public class NproPurchRequestHeaderController extends AbstractController {

    private static final long serialVersionUID = -4123823577744890422L;
    // 注入业务层
    @Autowired
    private NproPurchRequestHeaderService nproPurchRequestHeaderService;
    @Autowired
    private NproPurchRequestItemService nproPurchRequestItemService;
    @Autowired
    private ScmPoHeaderService scmPoHeaderService;
    @Autowired
    private ScmPoItemService scmPoItemService;
    @Autowired
    private HistoricalPriceService historicalPriceService;


    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        params.put("purch_request_type", "npro");
        // 查询用户列表
        PageUtils page = nproPurchRequestHeaderService.queryPage(params);
        return R.ok(page);
    }

    @SysLog("保存申请采购抬头信息和行项目")
    @RequestMapping(value = "/save", produces = "application/json; utf-8")
    // 后台@RequestBody来标识需要从请求体中解析数据
    //@RequiresPermissions("vendorEnclosure:save")
    public R save(@RequestBody JSONObject obj) {
        String data = obj.toJSONString();
        //解析json数据
        JSONObject json = JSON.parseObject(data);
        //从json对象中拿到抬头信息后转换成对应的抬头对象
        JSONObject json_ = JSON.parseObject(json.getString("nproPurchRequestHeaderEntity"));
        NproPurchRequestHeaderEntity nproPurchRequestHeaderEntity = new NproPurchRequestHeaderEntity();
        NproPurchRequestItemEntity nproPurchRequestItemEntity = new NproPurchRequestItemEntity();
        //采购申请行项目
        List<NproPurchRequestItemEntity> entityList = null;
        //采购组
        String purchGroup = json_.getString("purchGroup");
        if (json_ != null) {
            nproPurchRequestHeaderEntity.setPkId(SunnykidText.getUUID());
            nproPurchRequestHeaderEntity.setPurchRequestType(json_.getString("purchRequestType"));
            nproPurchRequestHeaderEntity.setPurchRequestStaff(json_.getString("purchRequestStaff"));
            nproPurchRequestHeaderEntity.setPurchRequestDept(json_.getString("purchRequestDept"));
        }
        JSONArray itmelist = JSONArray.parseArray(json.getString("nproPurchRequestItemEntity"));
        for (int i = 0; i < itmelist.size(); i++) {
            JSONObject jo = JSONObject.parseObject(itmelist.getString(i));
            nproPurchRequestItemEntity.setPurchGroup(purchGroup);
            nproPurchRequestItemEntity.setPkId(SunnykidText.getUUID());
            entityList = new ArrayList<NproPurchRequestItemEntity>();

            for (String key : jo.keySet()) {
                if (key.equals("subjectCategory")) {
                    nproPurchRequestItemEntity.setSubjectCategory(jo.getString(key));
                }
                if (key.equals("purchOrg")) {
                    nproPurchRequestItemEntity.setPurchOrg(jo.getString(key));
                }
                if (key.equals("factory")) {
                    nproPurchRequestItemEntity.setFactory(jo.getString(key));
                }
                if (key.equals("costCenter")) {
                    nproPurchRequestItemEntity.setCostCenter(jo.getString(key));
                }
                if (key.equals("materialGroup")) {
                    nproPurchRequestItemEntity.setMaterialGroup(jo.getString(key));
                }
                if (key.equals("usePeople")) {
                    nproPurchRequestItemEntity.setUsePeople(jo.getString(key));
                }
                if (key.equals("materialDesc")) {
                    nproPurchRequestItemEntity.setMaterialDesc(jo.getString(key));
                }
                if (key.equals("applyQty")) {
                    nproPurchRequestItemEntity.setApplyQty(jo.getBigDecimal(key));
                }
                if (key.equals("measureUnit")) {
                    nproPurchRequestItemEntity.setMeasureUnit(jo.getString(key));
                }
                if (key.equals("purchGroup")) {
                    nproPurchRequestItemEntity.setSubjectCategory(jo.getString(key));
                }
                if (key.equals("requestDate")) {
                    nproPurchRequestItemEntity.setRequestDate(jo.getSqlDate(key));
                }
                if (key.equals("deliveryDate")) {
                    nproPurchRequestItemEntity.setDeliveryDate(jo.getSqlDate(key));
                }
                if (key.equals("deliveryAddress")) {
                    nproPurchRequestItemEntity.setDeliveryAddress(jo.getString(key));
                }
                if (key.equals("mainAssetsCode")) {
                    nproPurchRequestItemEntity.setMainAssetsCode(jo.getString(key));
                }
                if (key.equals("assetsSencondCode")) {
                    nproPurchRequestItemEntity.setAssetsSencondCode(jo.getString(key));
                }
                if (key.equals("internalOrderCode")) {
                    nproPurchRequestItemEntity.setInternalOrderCode(jo.getString(key));
                }
            }
            entityList.add(nproPurchRequestItemEntity);
        }
        if (nproPurchRequestHeaderEntity != null && nproPurchRequestItemEntity != null) {
            this.nproPurchRequestHeaderService.insert(nproPurchRequestHeaderEntity);
            this.nproPurchRequestItemService.insertBatch(entityList);
            return R.ok();
        }
        return R.ok();
    }

    /**
     * 跳转至采购单申请编辑页面
     *
     * @return
     */
    @RequestMapping("/toEdit/{pkId}")
    public ModelAndView toEdit(@PathVariable("pkId") String pkId) {
        //通过Id查询抬头信息
        NproPurchRequestHeaderEntity nproPurchRequestHeaderEntity = this.nproPurchRequestHeaderService.selectById(pkId);
        //采购申请单号
        String purchRequestCode = nproPurchRequestHeaderEntity.getPurchRequestCode();
        List<NproPurchRequestItemEntity> itemlist = this.nproPurchRequestItemService.findByNo(purchRequestCode, null);
        if (itemlist != null && itemlist.size() > 0) {
            for (NproPurchRequestItemEntity ite : itemlist) {
                //subjectCategory
                if ("K".equals(ite.getSubjectCategory())) {
                    ite.setSubjectCategory("K-成本中心");
                }
                if ("A".equals(ite.getSubjectCategory())) {
                    ite.setSubjectCategory("A-固定资产");
                }
                if ("F".equals(ite.getSubjectCategory())) {
                    ite.setSubjectCategory("F-在建工程");
                }
            }
        }
        //把查询出来的对象赋值给供应商实体
        ModelAndView modelAndView = new ModelAndView("modules/requisition/requisition_edit");
        modelAndView.addObject("nproPurchRequestHeaderEntity", nproPurchRequestHeaderEntity);
        modelAndView.addObject("itemlist", itemlist);
        return modelAndView;
    }

    /**
     * 更采购申请订单信息
     */
    @SysLog("修改供应商信息")
    @RequestMapping("/update")
    public R update(@RequestBody JSONObject obj) {
        String data = obj.toJSONString();
        //解析json数据
        JSONObject json = JSON.parseObject(data);
        //从json对象中拿到抬头信息后转换成对应的抬头对象
        JSONObject json_ = JSON.parseObject(json.getString("nproPurchRequestHeaderEntity"));
        NproPurchRequestHeaderEntity nproPurchRequestHeaderEntity = new NproPurchRequestHeaderEntity();
        NproPurchRequestItemEntity nproPurchRequestItemEntity = new NproPurchRequestItemEntity();
        //采购申请行项目
        List<NproPurchRequestItemEntity> entityList = null;
        //采购组
        String purchGroup = json_.getString("purchGroup");
        if (json_ != null) {
            nproPurchRequestHeaderEntity.setPkId(json_.getString("pkId"));
            nproPurchRequestHeaderEntity.setPurchRequestType(json_.getString("purchRequestType"));
            nproPurchRequestHeaderEntity.setPurchRequestStaff(json_.getString("purchRequestStaff"));
            nproPurchRequestHeaderEntity.setPurchRequestDept(json_.getString("purchRequestDept"));
        }
        JSONArray itmelist = JSONArray.parseArray(json.getString("nproPurchRequestItemEntity"));
        for (int i = 0; i < itmelist.size(); i++) {
            JSONObject jo = JSONObject.parseObject(itmelist.getString(i));

            nproPurchRequestItemEntity.setPurchGroup(purchGroup);
            entityList = new ArrayList<NproPurchRequestItemEntity>();
            for (String key : jo.keySet()) {
                if (key.equals("pkId")) {
                    nproPurchRequestItemEntity.setPkId(jo.getString(key));
                }
                if (key.equals("subjectCategory")) {
                    nproPurchRequestItemEntity.setSubjectCategory(jo.getString(key));
                }
                if (key.equals("purchOrg")) {
                    nproPurchRequestItemEntity.setPurchOrg(jo.getString(key));
                }
                if (key.equals("factory")) {
                    nproPurchRequestItemEntity.setFactory(jo.getString(key));
                }
                if (key.equals("costCenter")) {
                    nproPurchRequestItemEntity.setCostCenter(jo.getString(key));
                }
                if (key.equals("materialGroup")) {
                    nproPurchRequestItemEntity.setMaterialGroup(jo.getString(key));
                }
                if (key.equals("usePeople")) {
                    nproPurchRequestItemEntity.setUsePeople(jo.getString(key));
                }
                if (key.equals("materialDesc")) {
                    nproPurchRequestItemEntity.setMaterialDesc(jo.getString(key));
                }
                if (key.equals("applyQty")) {
                    nproPurchRequestItemEntity.setApplyQty(jo.getBigDecimal(key));
                }
                if (key.equals("measureUnit")) {
                    nproPurchRequestItemEntity.setMeasureUnit(jo.getString(key));
                }
                if (key.equals("purchGroup")) {
                    nproPurchRequestItemEntity.setSubjectCategory(jo.getString(key));
                }
                if (key.equals("requestDate")) {
                    nproPurchRequestItemEntity.setRequestDate(jo.getSqlDate(key));
                }
                if (key.equals("deliveryDate")) {
                    nproPurchRequestItemEntity.setDeliveryDate(jo.getSqlDate(key));
                }
                if (key.equals("deliveryAddress")) {
                    nproPurchRequestItemEntity.setDeliveryAddress(jo.getString(key));
                }
                if (key.equals("mainAssetsCode")) {
                    nproPurchRequestItemEntity.setMainAssetsCode(jo.getString(key));
                }
                if (key.equals("assetsSencondCode")) {
                    nproPurchRequestItemEntity.setAssetsSencondCode(jo.getString(key));
                }
                if (key.equals("internalOrderCode")) {
                    nproPurchRequestItemEntity.setInternalOrderCode(jo.getString(key));
                }
            }
            entityList.add(nproPurchRequestItemEntity);
        }
        if (nproPurchRequestHeaderEntity != null && nproPurchRequestItemEntity != null) {
            this.nproPurchRequestHeaderService.updateById(nproPurchRequestHeaderEntity);
            this.nproPurchRequestItemService.updateById(nproPurchRequestItemEntity);
            return R.ok();
        }
        return R.ok();
    }

    /**
     * 货源指定信息(此处的数据要进订单表)
     */
    @SysLog("货源指定信息")
    @Transactional(rollbackFor = Exception.class)
    @RequestMapping("/updateSource")
    public synchronized R updateSource(@RequestBody JSONObject obj) {
        //解析json数据
        JSONObject json = JSON.parseObject(obj.toJSONString());
        NproPurchRequestHeaderEntity nproPurchRequestHeader = null;
        //订单数据(目前都先走比价流程)
        ScmPoHeaderEntity scmPoHeaderEntity = new ScmPoHeaderEntity();//订单抬头
        ScmPoItemEntity scmPoItemEntity = null;
        List<ScmPoItemEntity> ScmPoItemList = new ArrayList<>();
        List<HistoricalPriceEntity> historicalPriceList = new ArrayList<>();
        //采购申请行项目
        List<NproPurchRequestItemEntity> entityList = null;
        /********************************************************/
        JSONArray itmelist = JSONArray.parseArray(json.getString("supplyGoodsEntity"));
        Timestamp date;
        /****************2019-06-05 yanfei*************************************/
        /**************订单号生成*****************/
        //1.查询最大订单号
        String poNo = this.scmPoHeaderService.selectnum();
        //2.查询最大订单号
        int edition = 0;
        //3.String 转换成int
        int suffix = 0;
        String po_no = "";
        if ("".equals(poNo) || poNo == null) {
            suffix = 0;
            edition = 0;
        } else {
            suffix = Integer.parseInt(poNo.substring(3, poNo.length()));
            edition = this.scmPoHeaderService.getEdition();
        }
        // 看版本号是否和查出来的一至
        if (suffix == edition) {
            edition++;
            suffix++;
            po_no = StringUtils.makeStr("480", suffix, 7).replaceAll(" ", "0");
            for (int i = 0; i < itmelist.size(); i++) {
                // 去掉value为空的键值对
                JSONObject jo = JSONObject.parseObject(JSONObject.parseObject(itmelist.getString(i)).toString().replaceAll(",\"\\w+\":\"\"", ""));
                entityList = new ArrayList<>();
                nproPurchRequestHeader = new NproPurchRequestHeaderEntity();
                scmPoItemEntity = new ScmPoItemEntity(); //订单行项目
                /****json对象转换成JavaBean*********/
                if (!jo.isEmpty()) {
                    //1、使用JSONObject
                    //订单行项目数据  //measureUnit
                    SupplyGoodsEntityVO supplyGoodsEntity = JSONObject.toJavaObject(jo.getJSONObject("SupplyGoodsEntityVO"), SupplyGoodsEntityVO.class);
                    scmPoItemEntity.setPoItemId(SunnykidText.getUUID());//主键id
                    scmPoItemEntity.setPrNo(supplyGoodsEntity.getPurchRequestCode()); //采购申请编码
                    //生成订单行项目号 00010,00020...
                    scmPoItemEntity.setItemNo(String.format("%05d", (i + 1) * 10));
                    //请购行项目号
                    scmPoItemEntity.setPrItemNo(supplyGoodsEntity.getPurchRequestItemCode());
                    scmPoItemEntity.setSubjectCategory(supplyGoodsEntity.getSubjectCategory());//科目类别
                    scmPoItemEntity.setMaterialDesc(supplyGoodsEntity.getMaterialDesc());//物料描述
                    scmPoItemEntity.setFactory(supplyGoodsEntity.getFactory());//工厂
                    scmPoItemEntity.setStorageLocation(supplyGoodsEntity.getStorageLocation());//库存地点
                    scmPoItemEntity.setMaterialCode(supplyGoodsEntity.getLedgerAccount());//总账科目，放入物料编码字段，同步SAP时从物料编码中取出总账科目
                    scmPoItemEntity.setInternalPoNo(supplyGoodsEntity.getInternalOrderCode());//内部订单号
                    scmPoItemEntity.setMaterialGroup(supplyGoodsEntity.getMaterialGroup());//物料组
                    scmPoItemEntity.setRequester(supplyGoodsEntity.getApplier());//申请者

                    scmPoItemEntity.setPoCount(supplyGoodsEntity.getQuantity());//采购订单数量(目前从比价完后的数据里面拿)
                    scmPoItemEntity.setPoPrice(supplyGoodsEntity.getTaxPrice()); //含税单价
                    scmPoItemEntity.setPoUnit(supplyGoodsEntity.getMeasureUnit()); //订单货物的计量单位(订单选择)
                    scmPoItemEntity.setPriceUnit(supplyGoodsEntity.getPriceUnit());//采购订单的计量单位(需求是最小起订数量)

                    scmPoItemEntity.setTaxCode(supplyGoodsEntity.getTaxCode());//税码

                    /*************2019-07-20 这里的交期改为非生产性需求日期*************************/
                    //scmPoItemEntity.setDeliveryDate(supplyGoodsEntity.getDeliveryDate());//交期
                    scmPoItemEntity.setDeliveryDate(supplyGoodsEntity.getRequestDate());//非生产性需求日期

                    /*************2019-07-20 这里的交期改为非生产性需求日期*************************/
                    scmPoItemEntity.setCostCenter(supplyGoodsEntity.getCostCenter()); //成本中心
                    scmPoItemEntity.setPoNo(po_no); //这是错的要从新生成多 (自动生成)
                    scmPoItemEntity.setItemUuid(supplyGoodsEntity.getPkId()); //行项目id
                    scmPoItemEntity.setCreatedBy(this.getUser().getUsername());//创建者
                    date = DateUtils.currentTimestamp();
                    scmPoItemEntity.setCreationDate(date);//创建时间
                    //备注
                    scmPoItemEntity.setRemark(supplyGoodsEntity.getRemark());
                    //送货地址
                    scmPoItemEntity.setDeliveryAddress(supplyGoodsEntity.getDeliveryAddress());
                    //*************记录表******************/
                    //得到抬头id
                    nproPurchRequestHeader = this.nproPurchRequestHeaderService.findByNo(supplyGoodsEntity.getPurchRequestCode());//通过采购申请编码得到对应的id
                    /*******处理订单抬头****************/
                    scmPoHeaderEntity.setPoId(SunnykidText.getUUID());
                    scmPoHeaderEntity.setPoNo(po_no);
                    scmPoHeaderEntity.setPoType(nproPurchRequestHeader.getPurchRequestType());//订单类型
                    //科目类别 ==采购凭证类别
                    scmPoHeaderEntity.setPoCategory(supplyGoodsEntity.getSubjectCategory()); //采购凭证类别
                    scmPoHeaderEntity.setVendorId(supplyGoodsEntity.getVendorCode()); //以后供应商编码作为供应商的ID
                    //将8001/8002/8003工厂对应公司代码改为8888
                    if (supplyGoodsEntity.getFactory().equals("8001") || supplyGoodsEntity.getFactory().equals("8002") || supplyGoodsEntity.getFactory().equals("8003")) {
                        scmPoHeaderEntity.setCompanyCode("8888");
                    } else {
                        scmPoHeaderEntity.setCompanyCode(supplyGoodsEntity.getFactory());//公司代码
                    }
                    //采购组
                    scmPoHeaderEntity.setPurchGroup(supplyGoodsEntity.getPurchGroup());
                    //采购组织， 除1700和1800，其他工厂采购组织1000,1700和1800采购组织1400
                    if (supplyGoodsEntity.getFactory().equals("1700") || supplyGoodsEntity.getFactory().equals("1800")) {
                        scmPoHeaderEntity.setPurchOrg("1400");
                    } else {
                        //supplyGoodsEntity.getPurchOrg()
                        scmPoHeaderEntity.setPurchOrg("1000");
                    }
                    scmPoHeaderEntity.setCreationDate(date);//创建时间
                    scmPoHeaderEntity.setCreatedBy(this.getUser().getUsername());//创建者
                    if ("".equals(supplyGoodsEntity.getPayCondition()) || supplyGoodsEntity.getPayCondition() == null) {
                        scmPoHeaderEntity.setPayCondition("");//付款条件代码
                    } else {
                        scmPoHeaderEntity.setPayCondition(supplyGoodsEntity.getPayCondition());//付款条件代码
                    }
                    if ("".equals(supplyGoodsEntity.getI18nTradeTerms()) || supplyGoodsEntity.getI18nTradeTerms() == null) {
                        scmPoHeaderEntity.setI18nTradeTerms("");//国际贸易条款
                    } else {
                        scmPoHeaderEntity.setI18nTradeTerms(supplyGoodsEntity.getI18nTradeTerms());//国际贸易条款
                    }
                    scmPoHeaderEntity.setCurrencyCode(supplyGoodsEntity.getCurrency()); //货币币种
                    scmPoHeaderEntity.setCompanyName(supplyGoodsEntity.getVendorName());//供应商名称
                    scmPoHeaderEntity.setPoFlag("NPRO"); //非生产 NPRO  生产 PRO
                    scmPoHeaderEntity.setEdition(edition);//版本控制
                    /**************采购订单行项目*******************/
                    supplyGoodsEntity.setGoodsStatus(0);

                    NproPurchRequestItemEntity nproPurchRequestItemEntity = this.nproPurchRequestItemService.selectById(supplyGoodsEntity.getPkId());
                    nproPurchRequestItemEntity.setGoodsStatus(0);
                    entityList.add(nproPurchRequestItemEntity);
                    //订单行项目
                    ScmPoItemList.add(scmPoItemEntity);
                    //非生产性 生成订单时把价格保存到历史订单中
                    if (historicalPriceService.convertToHistoryPrice(supplyGoodsEntity) != null) {
                        historicalPriceList.add(historicalPriceService.convertToHistoryPrice(supplyGoodsEntity));
                    }
                }
                /******有问题*******/
                if (nproPurchRequestHeader != null && entityList.size() > 0) {
                    //货源已指定状态
                    nproPurchRequestHeader.setGoodsStatus(0);
                    this.nproPurchRequestHeaderService.updateName(nproPurchRequestHeader);
                    this.nproPurchRequestItemService.updateBatchById(entityList);
                }

            }

            this.scmPoHeaderService.insertOrUpdate(scmPoHeaderEntity);
            this.scmPoItemService.insertBatch(ScmPoItemList);

            if (!CollectionUtils.isEmpty(historicalPriceList)) {
                historicalPriceService.insertBatch(historicalPriceList);
            }
        }
        return R.ok().put("poNo", po_no);

    }
    /****************************yanfei 2019-06-05**************************************/

    /**
     * 询价
     *
     * @param
     * @return
     */
    @RequestMapping("/inquiry/{itemrowData}")
    public ModelAndView inquiry(@PathVariable("itemrowData") String itemrowData) {

        //行项目id
        List<String> pklist = new ArrayList<String>(itemrowData.split(",").length);
        Collections.addAll(pklist, itemrowData.split(","));
        List<NproPurchRequestItemEntity> itemlist = this.nproPurchRequestItemService.selectBatchIds(pklist);
        //把查询出来的对象赋值给供应商实体
        ModelAndView modelAndView = new ModelAndView("modules/requisition/inquiry/inquiry_add");
        modelAndView.addObject("itemlist", itemlist);
        modelAndView.getModel().put("companyCode", itemlist.get(0).getFactory());
        modelAndView.getModel().put("purchaseOrg", itemlist.get(0).getPurchOrg());
        modelAndView.getModel().put("purchaseGrp", itemlist.get(0).getPurchGroup());
        modelAndView.getModel().put("currency", itemlist.get(0).getCurrency());
        modelAndView.getModel().put("beginDate", DateUtils.getTime());

        return modelAndView;
    }

    /**
     * 生成报价单
     */

    @RequestMapping("/generateQuotations")
    public ModelAndView generateQuotations() {
        ModelAndView modelAndView = new ModelAndView("modules/requisition/inquiry/inquiry_list");
        return modelAndView;
    }

    /**
     * 报价
     */

    @RequestMapping("/offer")
    public ModelAndView offer() {
        //把查询出来的对象赋值给供应商实体
        ModelAndView modelAndView = new ModelAndView("modules/requisition/offer/offer_list");
        return modelAndView;
    }

    /**
     * 比价 （后续跟据要求可以做优化）
     */
    @RequestMapping("/parity")
    public ModelAndView parity() {
        //把查询出来的对象赋值给供应商实体
        ModelAndView modelAndView = new ModelAndView("modules/requisition/parity/parity_list");
        modelAndView.addObject("poFlag", "PR");
        return modelAndView;
    }

}
